<div class="ui-shade" i-dom="shade" i-tap="shadeClose"></div>
{{if spuTitle}}
<header>
    <h1>{{spuTitle}}</h1>
    <i i-tap="toggleFilterWindow"></i>
</header>
{{else}}
<header>
    <div class="tab active" i-tap="toggleCategoryList" i-dom="categoryTab"><span>类别</span></div>
    <div class="tab" i-tap="toggleBrandList" i-dom="brandTab"><span>品牌</span></div>
    <i i-tap="toggleFilterWindow"></i>
</header>
{{/if}}

<div class="header-holder"></div>
<div class="categoryArea ui-c-f" i-dom="categoryArea">
    {{division "category"}}
    <div class="mainlist">
        <ul class="slider">
            {{each categoryList||[]}}
            <li i-dom="categoryMainList{{$index}}" s-tap="changeCategory({{$value._id}})">
                {{$value.name}}
            </li>
            {{/each}}
        </ul>
    </div>
    <div class="sublist">
        <ul class="slider">
            <li s-tap="selectCategory()">全部</li>
            {{each categorySubList||[]}}
            <li s-tap="selectCategory({{$value._id}})">
                {{$value.name}}
            </li>
            {{/each}}
        </ul>
    </div>

    {{/division}}
</div>
<div class="brandArea" i-dom="brandArea">
    {{division "brand"}}
    <div class="slider">
        {{each brandList||[]}}
        <div class="brand" s-tap="selectBrand({{$value._id}})">
            <img src="{{$value.pic}}?imageView2/1/w/200/h/200">
            <h6>{{$value.name}}</h6>
        </div>
        {{/each}}
    </div>
    {{if brandList&&brandList.length>0}}
    <div class="brand-clear" i-tap="selectBrand()">清除所选</div>
    {{/if}}
    {{if brandList&&brandList.length==0}}
    <div class="brand-defualt ui-v-a"><span>暂时没有品牌</span></div>
    {{/if}}
    {{/division}}
</div>
<div class="list" i-dom="productArea">
    {{division "product"}}
    {{each list}}
    <div class="product" i-tap="viewProduct({{$value._id}})">

        <img src="{{$value.pics[0]}}?imageView2/1/w/200/h/200">

        <div>
            <div class="thum-price">
                {{if $value.price_cost}}
                <span class="ui-price price-gray">{{$value.price_cost/10}}</span>
                {{/if}}
                <span class="ui-price price-red">{{$value.price/10}}</span>
            </div>

            {{if $value.specs&&$value.specs.length>0}}
            <div class="specs">
                {{each $value.specs as specs}}
                <span class="spec">{{specs.spec_name}}:{{specs.specvalue_name}}</span>
                {{/each}}
            </div>
            {{/if}}

            <h1>
                {{if $value.time_kill}}<b class="seckill">秒杀</b>{{/if}}{{$value.title}}
            </h1>

            {{if $value.time_kill>0}}
            <div class="tag-timer" data-time="{{$value.time_kill}}">
                {{if $value.time_kill<0}}
                <span>已过期</span>
                {{else}}
                <span>{{$value.time_kill | formatTime:'hh:mm:ss'}}</span>
                {{/if}}
            </div>
            {{/if}}

            {{if $value.label&&$value.length>0}}
            <div class="tags">
                {{each $value.label as label}}
                <span class="tag">{{label}}</span>
                {{/each}}
            </div>
            {{/if}}
        </div>

    </div>
    {{/each}}
    {{/division}}
</div>

<div class="tips" i-dom="tips">
    正在加载更多
</div>

<div class="window-filter" i-dom="filterArea">
    {{division "filter"}}
    <div class="filter-header ui-v-a">
        <i></i>
        <span>筛选</span>
    </div>

    <div class="filter-list">
        <div class="slider">
            <div i-tap="clearFilter" class="clearAll">清除所选</div>

            {{each filterList as ca}}
            {{if ca.strategy}}
            <div>
                <div class="category-title">
                    {{ca.spec_name}}
                </div>
                {{each ca.strategyList}}
                <span class="category-tag" s-tap="expandFilter"
                      data-strategy="{{ca.spec_id}}>{{$index}}">{{$index}}</span>
                {{/each}}
                {{if ca.strategyList[ca.depart]}}
                <div class="category-strategy">

                    <div class="category-subtitle"></div>
                    {{each ca.strategyList[ca.depart]}}
                    <span class="category-tag" s-tap="setFilter" data-tag="{{ca.spec_id}}>{{$index}}">{{$value}}</span>
                    {{/each}}

                </div>
                {{/if}}
            </div>
            {{else}}
            <div>
                <div class="category-title">
                    {{ca.spec_name}}
                </div>
                {{each ca.specvalue}}
                <span class="category-tag" s-tap="setFilter"
                      data-tag="{{ca.spec_id}}>{{$value._id}}">{{$value.name}}</span>
                {{/each}}
            </div>
            {{/if}}
            {{/each}}

            <div class="filter-holder"></div>
        </div>
    </div>
    {{/division}}
</div>

<footer i-dom="footer">
    <button class="ui-btn-yellow ui-v-a" i-tap="Searching"><span>确定</span></button>
</footer>


<style>
    .ui-shade {
        /*****************
        z-index: 10或者20;
        JS控制
        *****************/
        opacity: 0;
        display: none;
        transition: opacity 0.3s;
        -webkit-transition: opacity 0.3s;
    }

    .header-holder {
        height: 36px;
    }

    header {
        height: 36px;
        font-size: 14px;
        position: fixed;
        top: 0;
        width: 100%;
        background: white;
        border-bottom: solid 1px #f0f0f0;
        z-index: 11;
    }

    header h1 {
        font-weight: lighter;
        font-size: 14px;
        width: 80%;
        float: left;
        height: 36px;
        line-height: 36px;
        padding: 0 5%;
    }

    header .tab {
        opacity: 0.6;
        float: left;
        text-align: center;
        width: 45%;
        height: 100%;
    }

    header i {
        float: left;
        text-align: center;
        width: 10%;
        height: 100%;
        background: url(img/ic_filter.png) no-repeat center;
        background-size: 14px;
    }

    .categoryArea {
        border-bottom: solid 1px #dddddd;
        display: none;
        overflow: hidden;
        z-index: 15;
        top: 37px;
        left: 0;
        position: fixed;
        width: 100%;
        background: #f0f0f0;
        transition: height 0.3s;
        -webkit-transition: height 0.3s;
    }

    .categoryArea .mainlist {
        float: left;
        width: 50%;
        height: 200px;
    }

    .categoryArea li {
        list-style: none;
        line-height: 36px;
        height: 36px;
        padding: 0 8px;
        font-size: 12px;
        color: #888888;
    }

    .categoryArea .mainlist li.select {
        background: white;
        color: #111111;
    }

    .categoryArea .sublist {
        float: left;
        width: 50%;
        height: 200px;
        background: white;
    }

    .brandArea {
        border-bottom: solid 1px #dddddd;
        display: none;
        overflow: hidden;
        text-align: center;
        z-index: 15;
        top: 37px;
        left: 0;
        position: fixed;
        width: 100%;
        background: #f0f0f0;
        transition: height 0.3s;
        -webkit-transition: height 0.3s;
    }

    .brandArea > .slider {
        position: absolute;
        white-space: nowrap;
        height: 100px;
        padding: 8px;
    }

    .brandArea .brand {
        display: inline-block;
    }

    .brandArea .brand > img {
        width: 80px;
        height: 80px;
    }

    .brandArea .brand > h6 {
        font-size: 10px;
        font-weight: lighter;
    }

    .brand-defualt {
        height: 100px;
        font-size: 12px;
        color: #888888;
    }

    .brand-clear {
        font-size: 12px;
        height: 20px;
        line-height: 20px;
        margin: 120px 8px 0 8px;
        padding-top: 2px;
        border-top: solid 1px #dddddd;
        text-align: center;
        color: #888888;
    }

    .tab > span {
        vertical-align: middle;
    }

    .tab::after {
        content: '';
        display: inline-block;
        height: 100%;
        width: 8px;
        margin: 0 4px;
        vertical-align: middle;
        background: url(img/ic_arrow_down.png) no-repeat center;
        background-size: 8px;
    }

    /*.tab.select::after {*/
    /*background-image: url(img/ic_arrow_up.png);*/
    /*}*/

    .tab.active {
        opacity: 1;
    }

    .product {
        width: 100%;
        height: 100px;
        padding: 8px 0;
        background: white;
        border-top: solid 1px #f0f0f0;
    }

    .product > img {
        margin-left: 8px;
        display: block;
        position: absolute;
        width: 100px;
        height: 100px;
    }

    .product > div {
        margin-right: 8px;
        margin-left: 116px;
    }

    .product h1 {
        font-size: 13px;
        width: 210px;
        font-weight: lighter;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }

    .tag:first-child {
        padding: 2px;
        font-size: 10px;
        color: white;
        background: #ffba00;
    }

    .tag {
        padding: 2px;
        font-size: 10px;
        color: #888888;
        background: #eeeeee;
    }

    b.seckill {
        padding: 2px;
        font-size: 10px;
        color: white;
        background: red;
        display: inline-block;
        margin-right: 2px;
        font-weight: lighter;
    }

    .tag-timer::before {
        content: '';
        display: inline-block;
        width: 10px;
        height: 100%;
        background: url(img/ic_clock.png) no-repeat center;
        background-size: contain;
        margin: 0 2px;
        vertical-align: middle;
    }

    .tag-timer > span {
        vertical-align: middle;
    }

    .tag-timer {
        display: inline-block;
        font-size: 10px;
        height: 16px;
        padding: 0 4px 0 2px;
    }

    .tag-timer {
        color: white;
        background: rgba(0, 0, 0, 0.7);

    }

    .thum-price {
        position: absolute;
        text-align: right;
        right: 8px;
        margin-top: 80px;
    }

    .price-red {
        color: #ff0000;
        font-size: 14px;
        font-weight: normal;
    }

    .price-gray {
        color: #888888;
        text-decoration: line-through;
        font-size: 11px;
    }

    .tips {
        display: none;
        text-align: center;
        font-size: 12px;
        color: #888888;
        padding: 8px;
    }

    .specs {
        font-size: 10px;
        color: #888888;
        position: absolute;
        margin-top: 80px;
    }

    .spec {
        display: inline-block;
        padding: 2px;
    }

    .window-filter {
        background: #f0f0f0;
        display: none;
        position: fixed;
        width: 90%;
        height: 100%;
        z-index: 25;
        overflow-y: scroll;
        right: -90%;
        bottom: 0;
        transition: right 0.3s;
        -webkit-transition: right 0.3s;
    }

    .filter-header {
        height: 36px;
        font-size: 14px;
        width: 100%;
        background: white;
        border-bottom: solid 1px #f0f0f0;
        text-align: center;
    }

    .filter-header i {
        display: inline-block;
        text-align: center;
        width: 20px;
        height: 100%;
        background: url(img/ic_filter.png) no-repeat center;
        background-size: 14px;
        vertical-align: middle;
    }

    .filter-list {
        padding: 16px;
        height: 100%;
    }

    .clearAll {
        float: right;
        font-size: 12px;
    }

    .filter-holder {
        height: 60px;
    }

    .category-title {
        font-size: 12px;
        color: #888888;
        border-bottom: solid 1px #dddddd;
        width: 120px;
        margin-bottom: 8px;
        margin-top: 16px;
    }

    .category-subtitle::before {
        content: '';
        display: block;
        position: absolute;
        width: 8px;
        height: 8px;
        background: url(img/ic_arrow_111up.png) #f0f0f0 no-repeat center;
        background-size: contain;
        opacity: 1;
        margin-top: -5px;
        margin-left: 8px;
    }

    .category-subtitle {
        font-size: 12px;
        color: #888888;
        border-bottom: solid 1px #aaaaaa;
        margin-right: 200px;
        margin-bottom: 4px;
    }

    .category-tag {
        padding: 8px;
        font-size: 12px;
        text-align: center;
        min-width: 16px;
        height: 16px;
        background: #dddddd;
        display: inline-block;
        margin-right: 8px;
        margin-bottom: 8px;
        /*transition: all 0.3s;*/
        /*-webkit-transition: all 0.3s;*/
    }

    .category-tag.un {
        color: #aaaaaa;
        background: #E8E8E8;
    }

    .category-tag.select {
        background: #111111;
        color: white;
    }

    footer {
        display: none;
        transition: bottom 0.3s;
        -webkit-transition: bottom 0.3s;
    }

    footer .ui-btn-yellow {
        float: right;
        padding: 0;
        height: 34px;
        margin: 5px;
    }

    .ui-btn-yellow.un {
        background: #dddddd;
        color: #888888;
    }

</style>
